#include "StdAfx.h"
#include "Target.h"
#include "OceanViewFactory.h"


CTarget::CTarget(int iPower):CGtsNode(1, 0)
{
	this->setPower(iPower);
	view=(new  OceanViewFactory())->createTargetView();
	
}


CTarget::~CTarget(void)
{
}

void CTarget::correctState()
{
	double result = (getPower()-getInFlow())/getPower();
	if(result==0)
		iState=NORMAL_STATE;
	else if(result>0.2)
		iState=CRITICAL_STATE;
	else
		iState=WARNING_STATE;
}
